package com.qingcheng.util;

import com.qingcheng.service.business.AdService;
import com.qingcheng.service.goods.CategoryService;
import com.qingcheng.service.goods.SkuService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Init implements InitializingBean {

    @Autowired
    private CategoryService categoryService;
    @Autowired
    private AdService adService;
    @Autowired
    private SkuService skuService;

    public void afterPropertiesSet() throws Exception {
        System.out.println("缓存预热");
        //调用写入redis的方法
        categoryService.saveCategoryTreeRedis();
        adService.saveAdToRedisByPosition("web_index_lb");
        skuService.saveAllPriceToRedis();//加载价格数据
    }
}
